//index.js
//获取应用实例

var util = require('../../utils/util.js');  
var today = util.formatTime(new Date((new Date()).getTime() + (1000 * 60 * 60 * 24 * 7))).split(' ')[0]
var app = getApp()
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    date:today
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs' 
    })
  },
  bindViewTaplyb: function (e) {
    wx.navigateTo({
      url: '../liuyan/liuyan'
    })
  },
  bindViewTaplyb2: function (e) {
    wx.navigateTo({
      url: '../liuyannew/liuyannew'
    }) 
    
  },
  bindDateChange:function (e){
    console.log(e.data) 
  } ,
  onLoad: function () {
    // console.log('onLoad')
    var that = this
  	//调用应用实例的方法获取全局数据
    that.setData({
      userInfo: app.globalData.userInfo,
    })
   
    that.update()
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({ 
        userInfo:userInfo
      })
      that.update()
    })

    
    // console.log(app.globalData.userInfo)
    // console.log(this.data)
  } 
})
